<template>
  <div class="assess">
    <Header></Header>
    <div class="assessMain">
      <div class="mianOut mt20">
        <div class="mianInner1">
          <div class="assess-title2">
            <p :class="planSummaryName?'':'noPlanClass'"><img src="../../../static/images/sound.png" />提示信息：您收到{{planSummaryName}}，需要您进行评审工作。</p>
            <ul class="clearfix">
              <li class="active"
                  @click="$router.push('waitAssess2')">待评审</li>
              <li @click="reviewedHandle">已评审</li>
            </ul>
            <h4>待评审预案</h4>
          </div>
          <el-table ref="multipleTable"
                    :data="reviewList">
            <el-table-column type="index"
                             align='center'
                             label='序号'
                             width="150">
            </el-table-column>
            <el-table-column label="评审时间"
                             align='center'
                             width='350'>
                    <template slot-scope="scope">
                        <p><span>{{scope.row.reviewStartTime | timeBy}}</span>到<span>{{scope.row.reviewEndTime | timeBy}}</span></p>
					</template>
            </el-table-column>
            <el-table-column prop="planSummaryName"
                             label="评审预案任务"
                             align='center'
                             show-overflow-tooltip>
            </el-table-column>
            <el-table-column label="操作"
                             align='center'
                             width='250'>
                    <template slot-scope="scope">
                        <el-button class='detail-btn'
                         @click="goPath(scope.row)"><i class="el-icon-edit">评审</i></el-button>
					</template>
            </el-table-column>
          </el-table>
          <div class="page-container">
            <el-button>确定</el-button>
            <el-pagination :pager-count='5'
                           @current-change="handleCurrentChange"
                           :current-page="currentPage"
                           :page-size="pageSize"
                           layout="total, prev, pager, next, jumper"
                           :total="total">
            </el-pagination>
          </div>
        </div>
      </div>
    </div>
    <Footer />
  </div>
</template>
<script>
import Header from '../common/header2'
import Footer from '../common/footer'
import config from '../../config.js'
export default {
  components: {
    Header,
    Footer
  },
  data () {
    return {
      reviewList: [],
      currentPage: 1,
      pageSize: 10,
      total: 0,
      planSummaryName: ''
    };
  },
  created () {
      this.getreviewList()
  },
  filters: {
      timeBy(val){
          if(val){
              return val.substring(0,10)
          }
      }
  },
  methods: {
      goPath(row){
         localStorage.planid=row.planSummaryId
      localStorage.planname=row.planSummaryName
     localStorage.plancompanyName =row.companyName
      this.$router.push({name:'comAssess2',query:{id:row.planSummaryId,planSummaryName:row.planSummaryName}})
      },
      getreviewList () {
        let url = config.baseUrl + 'planreview/v1.0/planreview/querylist'
        let params = {
             "userId": JSON.parse(localStorage.getItem('user')).id,
             "current" : this.currentPage,
             "size": this.pageSize,
             "status": 2
         }
         this.$axios(url,{params: params})
         .then((res) =>{
             if(res.data.meta.success){
                 res.data.data.records.forEach((item) =>{
                     if(item.substringreviewStartTime){
                         return item.reviewStartTime.substring(0,10)
                     }
                 })
                this.reviewList = res.data.data.records
                this.total = res.data.data.total
                this.planSummaryName = res.data.data.records[0].planSummaryName.split('.docx')[0]
            }else{
                this.reviewList = []
				this.total = 0
            } 
         })
      },
      handleCurrentChange (val) {
          this.currentPage = val
          this.getreviewList()
        },
        reviewedHandle () {
            this.$router.push('assessed2')
            if(this.planSummaryName){
                this.$router.push({query:{'name':this.planSummaryName}})
            }         
        }
  },
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang='less'>
@import "../../../static/css/assess.less";
</style>
<style lang='less' scoped>
.assess {
  .assess-title2 {
    .allBtn {
      display: block;
      width: 136px;
      border-radius: 8px;
      height: 36px;
      text-align: center;
      line-height: 36px;
      color: #fff;
      background: #4080ff;
      background: linear-gradient(90deg, #6eb1ff 20%, #3372ff 80%);
      float: right;
      font-weight: normal;
      font-size: 14px;
      margin-right: 100px;
      position: relative;
      top: -8px;
    }
    .allBtn:hover{
        opacity: .8;
    }
    .noPlanClass{
        opacity: 0;
        filter: alpha(opacity=0);
    }
  }
}
</style>
